package com.ewing.extranal.im.service;

import java.util.List;

import com.ewing.extranal.im.dto.ImRelationInfo;
import com.ewing.extranal.im.dto.MessageItem;

/**
 * 类/接口注释
 * 
 * @author tansonlam
 * @createDate 2016年4月21日
 * 
 */
public class ImServiceImpl implements ImService {
    private ImRelation imRelation = new ImRelationImpl();
    private ImMessageStorager imMessageStorager = new ImMessageStoragerImpl();

    @Override
    public List<ImRelationInfo> getContactList(Long imUserId) {
        return imRelation.getRelation(imUserId);
    }

    @Override
    public ImRelationInfo addContact(Long imUserId, Long relImUser) {
        return imRelation.addRelation(imUserId, relImUser);
    }

    @Override
    public Boolean delContact(Long imUserId, Long relImUser) {
        imRelation.removeRelation(imUserId, relImUser);
        return true;
    }

    @Override
    public List<MessageItem> getChatHistory(Long imUserId, Long relImUser, String lastMessageId) {

        return imMessageStorager.getChatHistory(imUserId, relImUser, lastMessageId);
    }

    @Override
    public Boolean update2Read(Long imUserId, Long relImUserId, String messageId) {
        return imMessageStorager.update2Read(imUserId, relImUserId, messageId);
    }

}
